<#escape x as (x)!?html>
<head>
    <script type="text/javascript">
        var menuId = "Settings_Channel";
        var providerAuthenticationIndex = 0;
        var template;

        $(function() {
            template = $("#template").html();
        });


        function create(e) {

            if (!validateInputs($("#mainForm"))) {
                return;
            }

            $('input[name$="inclusiveTaxRate"]').eq(0).val($('input[name$="inclusiveTaxRate"]').eq(0).attr("checked"));
            $.ajax({
                type: "POST",
                url: "add!ajaxSubmit.action",
                data:  $("#mainForm").serialize(),
                dataType :"json",
                success: function(echo) {
                    if (echo.result == true) {
                        showTip(e, "Save success! You can keep going add new channel");
                        $("#mainForm").find("input[@name='id']").val("");
                        $("#mainForm").find("input[@name='code']").val("");
                        $("#mainForm").find("input[@name='passport']").val("");
                        $("#mainForm").find("input[@name='name']").val("");
                        $("#mainForm").find("input[@name='iataNumber']").val("");
                        $("#mainForm").find("input[@name='userName']").val("");
                        $("#mainForm").find("input[@name='password']").val("");
                    } else {
                        showTip(e, echo.result);
                    }
                },
                async: false
            });
        }
    </script>
</head>
<body>
<form id="mainForm">
    <fieldset>
        <legend>
            <span class="title">Channel Information</span>
        </legend>
        <table class="property_table">
            <tr>
                <td class="key">Passport:</td>
                <td class="key"><input type="text" class="longText" name="passport" validator="notEmpty"/></td>
            </tr>
            <tr>
                <td class="key">ID:</td>
                <td class="key"><input type="text" class="longText" name="id" validator="notEmpty"/></td>
            </tr>
            <tr>
                <td class="key">Code:</td>
                <td class="key"><input type="text" class="longText" name="code" validator="notEmpty"/></td>
            </tr>
            <tr>
                <td class="key">Name:</td>
                <td class="key"><input type="text" class="longText" name="name" validator="notEmpty"/></td>
            </tr>
            <tr>
                <td class="key">IATA:</td>
                <td class="key"><input type="text" class="longText" name="iataNumber"/></td>
            </tr>
            <tr>
                <td class="key">UserName:</td>
                <td class="key"><input type="text" class="longText" name="userName" validator="notEmpty"/></td>
            </tr>
            <tr>
                <td class="key">Password:</td>
                <td class="key"><input type="text" class="longText" name="password" validator="notEmpty"/></td>
            </tr>
            <tr>
                <td class="key">Tax Policy:</td>
                <td class="value">
                    [FIXED<input type="radio" name="taxPolicy" checked value="FIXED"/>]
                    [PERCENT<input type="radio" name="taxPolicy" value="PERCENT"/>]
                    [NONE<input type="radio" name="taxPolicy"  value="NONE"/>]
                </td>
            </tr>
            <tr>
                <td class="key">Inclusive Tax Rate:</td>
                <td class="key">
                    <input type="checkbox" class="longText" name="inclusiveTaxRate" <#if inclusiveTaxRate> checked="checked" </#if>/>
                </td>
            </tr>
        </table>
    </fieldset>

    <input type="button" value="Save" class="btn" onclick="create($(this))"/>
    <input type="button" value="Back" class="btn" onclick="window.location.href='query.action'"/>
</form>

</body>
</#escape>
